<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let animal = {
        eats: true,
      };
      let rabbit = {
        jumps: true,
        __proto__: animal, //隐藏
      };

      /*
        所有的对象都有hasOwnProperty方法，判断当前属性是否属于这个对象，属于返回ture，反之返回false 
      */
      console.log(rabbit.hasOwnProperty("eats"));
      console.log(rabbit.hasOwnProperty("jumps"));
      for (let k in rabbit) {
        if (rabbit.hasOwnProperty(k) === true) {
          console.log(k);
        }
      }
    </script>
  </body>
</html>
